/**
 * @author Tz, hxj
 * @date 2024/01/22 15:03
 * @Description 这里放定时执行的任务
 */
package com.bright.ghj.overt.task.timed;


import com.bright.ghj.overt.pojo.query.OpenReportRecordQuery;
import com.bright.ghj.overt.service.BaseDataService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.util.Calendar;

@Slf4j
@Component
public class TimedTask {

    @Autowired
    public BaseDataService baseDataService;

    @Scheduled(cron = "0 0 1 * * *")
    public void autoCreateOpenReportRecord() {
        Calendar cal = Calendar.getInstance();
        OpenReportRecordQuery openReportRecordQuery = new OpenReportRecordQuery();
        openReportRecordQuery.setYears(cal.get(Calendar.YEAR));
        openReportRecordQuery.setMonths(cal.get(Calendar.MONTH));
        baseDataService.autoCreateOpenReportRecord(openReportRecordQuery);
        log.info("自动刷新openReportRecord 执行完毕！");
    }

}